1. Field
Embodiments of the present invention relate to database systems, and more particularly to database replication.
2. Background
Data replication is the process of maintaining multiple copies of a database object in a distributed database system. Performance improvements can be achieved when data replication is employed, since multiple access locations exist for the access and modification of the replicated data. For example, if multiple copies of a data object are maintained, an application can access the logically “closest” copy of the data object to improve access times and minimize network traffic. In addition, data replication provides greater fault tolerance in the event of a server failure, since the multiple copies of the data object effectively become online backup copies if a failure occurs.
In data replication, materialization is a process that creates and activates subscriptions between a source (or primary) database and a replicate (or target) database, and copies data from the primary database to the replicate database, so that both databases contain identical data. Materialization can thus replace existing data (if any) in the replicate database with data from the source database.
A subscription allows a destination table in the replicate database to receive initial data from a primary (or source) table in the primary database through materialization, and to begin receiving subsequent replicated data updates. When users create publication subscriptions for publications created at a primary replication server, the replication server creates an article subscription for each article in the publication. When publication subscriptions are materialized atomically, non-atomically, or incrementally, one article subscription may be processed at a time. When publication subscriptions are materialized using “bulk” or no materialization methods, article subscriptions may be processed together.
When database transactions arrive at a replicate database While materialization (e.g., non-atomic materialization) is still in process, update or insert operations on data at the primary database can result in discrepancies such as duplicate rows at the replicate database. Discrepancies that may occur during materialization can also result in missing rows in a replicated table. Such discrepancies, including any failed replication operations, can corrupt data in the replicate database, affecting subsequent replication operations.